16 research outputs found
Trustworthy Refactoring via Decomposition and Schemes: A Complex Case Study
Widely used complex code refactoring tools lack a solid reasoning about the
correctness of the transformations they implement, whilst interest in proven
correct refactoring is ever increasing as only formal verification can provide
true confidence in applying tool-automated refactoring to industrial-scale
code. By using our strategic rewriting based refactoring specification
language, we present the decomposition of a complex transformation into smaller
steps that can be expressed as instances of refactoring schemes, then we
demonstrate the semi-automatic formal verification of the components based on a
theoretical understanding of the semantics of the programming language. The
extensible and verifiable refactoring definitions can be executed in our
interpreter built on top of a static analyser framework.Comment: In Proceedings VPT 2017, arXiv:1708.0688
Refactoring = Substitution + Rewriting
We present an approach to describing refactorings that abstracts away from
particular refactorings to classes of similar transformations, and presents an
implementation of these that works by substitution and subsequent rewriting.
Substitution is language-independent under this approach, while the rewrites
embody language-specific aspects. Intriguingly, it also goes back to work on
API migration by Huiqing Li and the first author, and sets refactoring in that
general context.Comment: 6p
Verification and Application of Program Transformations
A programtranszformáciĂł Ă©s a refaktorálás alapvetĹ‘ elemei a szoftverfejlesztĂ©si folyamatnak. A refaktorálást a kezdetektĹ‘l prĂłbálják szoftvereszközökkel támogatni, amelyek megbĂzhatĂłan Ă©s hatĂ©konyan valĂłsĂtják meg a szoftverminĹ‘sĂ©get javĂtĂł, a működĂ©st nem Ă©rintĹ‘ programtranszformáciĂłkat. A statikus elemzĂ©sre alapulĂł hibakeresĂ©s Ă©s a refaktorálási transzformáciĂłk az akadĂ©miában Ă©s a kutatás-fejlesztĂ©sben is nagy Ă©rdeklĹ‘dĂ©sre tartanak számot, ám mĂ©g ennĂ©l is fontosabb a szerepĂĽk a nagy bonyolultságĂş szoftvereket kĂ©szĂtĹ‘ vállalatoknál. Egyre pontosabbak Ă©s megbĂzhatĂłbbak a szoftverfejlesztĂ©st támogatĂł eszközök, de bĹ‘ven van mĂ©g min javĂtani.
A disszertáciĂł olyan definĂciĂłs Ă©s verifikáciĂłs mĂłdszereket tárgyal, amelyekkel megbĂzhatĂłbb Ă©s szĂ©lesebb körben használt programtranszformáciĂłs eszközöket tudunk kĂ©szĂteni. A dolgozat a statikus Ă©s a dinamikus verifikáciĂłt is Ă©rinti. ElsĹ‘kĂ©nt egy Ăşjszerű, tömör leĂrĂł nyelvet mutat be L-attribĂştum grammatikákhoz, amelyet tulajdonságalapĂş tesztelĂ©shez használt vĂ©letlenszerű adatgenerátorra kĂ©pezĂĽnk le. Ehhez egy esettanulmány társul, amely az Erlang programozási nyelv grammatikáját, majd a tesztelĂ©shez valĂł felhasználását mutatja be. A tesztelĂ©s mellett a formális helyessĂ©gbizonyĂtás kĂ©rdĂ©sĂ©t is vizsgáljuk, ehhez bevezetĂĽnk egy refaktorálások leĂrására szolgálĂł nyelvet, amelyben vĂ©grehajthatĂł Ă©s automatikusan bizonyĂthatĂł specifikáciĂłkat tudunk megadni. A nyelv környezetfĂĽggĹ‘ Ă©s feltĂ©teles termátĂráson, stratĂ©giákon Ă©s Ăşgynevezett refaktorálási sĂ©mákon alapszik. VĂ©gĂĽl, de nem utolsĂł sorban a programtranszformáciĂłk egy speciális alkalmazása kerĂĽl bemutatásra, amikor egy refaktorálĂł keretrendszert elĹ‘fordĂtĂłkĂ©nt használunk a feldolgozott programozási nyelv kiterjesztĂ©sĂ©re. UtĂłbbi mĂłdszerrel könnyen implementálhatĂł az Erlang nyelvben a kĂłdmigráciĂł
Towards Trustworthy Refactoring in Erlang
Tool-assisted refactoring transformations must be trustworthy if programmers
are to be confident in applying them on arbitrarily extensive and complex code
in order to improve style or efficiency. We propose a simple, high-level but
rigorous, notation for defining refactoring transformations in Erlang, and show
that this notation provides an extensible, verifiable and executable
specification language for refactoring. To demonstrate the applicability of our
approach, we show how to define and verify a number of example refactorings in
the system.Comment: In Proceedings VPT 2016, arXiv:1607.0183
Program Equivalence in an Untyped, Call-by-value Functional Language with Uncurried Functions
We aim to reason about the correctness of behaviour-preserving transformations of Erlang programs. Behaviour preservation is characterised by semantic equivalence. Based upon our existing formal semantics for Core Erlang, we investigate potential definitions of suitable equivalence relations. In particular we adapt a number of existing approaches of expression equivalence to a simple functional programming language that carries the main features of sequential Core Erlang; we then examine the properties of the equivalence relations and formally establish connections between them. The results presented in this paper, including all theorems and their proofs, have been machine checked using the Coq proof assistant
Validating Formal Semantics by Property-Based Cross-Testing
To describe the behaviour of programs in a programming language we can define a formal semantics for the language, and formalise it in a proof assistant. From this semantics we can derive the behaviour of each particular program in the language. But there remains the question of validating the formal semantics: have we got the formalisation right?
Our approach is to use property-based cross-testing of formal semantics, which is based on the combination of a number of existing approaches to validation. In particular, we give a concrete implementation of our ideas for a set of formalisations of Erlang and Core Erlang. We describe the adjustments that need to be made to execute these seman- tics, then we present and evaluate property-based testing in the context of cross-checking semantics, including random program generation and counterexample shrinking
Static analysis of function calls in Erlang
Functions and their relations can affect numerous properties and metrics of a functional program. To identify and represent the functions and their calling connections, software analysers commonly apply semantic function analysis, which derives the static call graph of the program, based on its source code. Function calls however may be dynamic and complex, making it difficult to statically identify the callee. Dynamic calls are determined just at run-time, static analysis therefore cannot be expected to fully identify every call.
Nevertheless, by utilising the results of a properly performed data-flow analysis as well as taking ambiguous references into account, numerous dynamic calls are discoverable and representable. We consider cases where the identifiers of the callee are statically determined, but they flow into the call expression from a different program point, and also, we manage to handle function calls whose identifiers are not fully identifiable at compile-time. By utilising the improved reference analysis, we extend the static call graph with various information about dynamic function calls. We investigate such a function call analysis in the programming language Erlang